home *** CD-ROM | disk | FTP | other *** search
- /*⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒø
- ›≥ ≥
- ›≥ Program Name: MISC.PRG Copyright: Gallagher Computing Corp. ≥
- ›≥ Date Created: 02/04/93 Language: Clipper 5.0 ≥
- ›≥ Time Created: 18:11:18 Author: Kevin S Gallagher ≥
- ›≥ c:/brief/clipper.src ≥
- ›¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
- flflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflflfl */
-
-
- #include "include1.ch"
-
- FUNCTION Ratio( nOriginal, nPacked )
- RETURN ( STR( 100 - INT( ( nPacked / nOriginal ) * 100 ), 3, 0 ) + "% " )
-
- FUNCTION FileType( nFileType )
- LOCAL cFileType
- DO CASE
- CASE nFileType EQ 9 ; cFileType := " Squashed "
- CASE nFileType EQ 8 ; cFileType := " Deflated "
- CASE nFileType EQ 6 ; cFileType := " Implode "
- CASE nFileType EQ 3 ; cFileType := " Packed "
- CASE nFileType EQ 1 ; cFileType := " Shrunk "
- CASE nFileType EQ 0 .OR. nFileType EQ 2 ; cFileType := " Stored "
- ENDCASE
- RETURN cFileType
-
- FUNCTION SkipArray( nMove, nArrPos, nArrayLength )
- IF nMove > 0
- IF ( nArrPos + nMove ) > nArrayLength
- nMove := nArrayLength - nArrPos
- ENDIF
- ELSE
- IF ( nArrPos + nMove ) < 1
- nMove := 1 - nArrPos
- ENDIF
- ENDIF
- nArrPos += nMove
- RETURN nMove
-
- FUNCTION CALCDATE( nYearMon, nMonDay )
- LOCAL nMonth, nYearInt
- nYearInt:=IF(nYearMon > 39,( ( nYearMon-40 )/ 2 ),( ( nYearMon/2 )+80 ) )
- nMonth :=INT( ( nMonDay - 1 ) / 32 )
- IF ( nYearMon % 2 ) = 1
- nMonth += 8
- ENDIF
- RETURN CTOD( PadNumL( nMonth ) + "/" + ;
- PadNumL( INT( ( ( nMonDay - 1 ) % 32 ) + 1 ) ) + "/" + ;
- PadNumL( INT( nYearInt ) ) )
-
- FUNCTION CALCTIME( nMinutes, nHourMin )
- LOCAL nHour
- nHour := INT( nHourMin / 8 )
- nMinutes /= 32
- nMinutes += ( nHourMin - ( nHour * 8 ) ) * 8
- RETURN ( PadNumL( nHour ) + ":" + PadNumL( INT( nMinutes ) ) )
-
-
- FUNCTION PadNumL( nNum )
- RETURN PADL( LTRIM( STR( nNum ) ), 2, "0" )
-
- FUNCTION GetColObject( b )
- RETURN ( b:GETCOLUMN( b:COLPOS ) )
-
- FUNCTION IsInPath(cFile)
- local cPath := GETENV("PATH") + [;], RetVal := []
- local nMarker:= AT(";", cPath)
- WHILE nMarker > 0
- RetVal := substr(cPath, 1, nMarker - 1)
- RetVal := RetVal + IF( RIGHT(RetVal, 1) != "\","\","")
- IF FILE(RetVal + cFile)
- exit
- ELSE
- nMarker := AT(";", cPath := substr(cPath, nMarker + 1) )
- RetVal := []
- ENDIF
- ENDDO
- return RetVal
-
- FUNCTION ZoomBox( bTR, bTC, bBR, bBC, cClrs, nDelay, lShad )
- local cDefCol, xx, bBCx, bTCx, bBRx, bTRx, savecur := SETCURSOR(0)
-
- DEFAULT bTR TO 0
- DEFAULT bTC TO 0
- DEFAULT bBR TO 24
- DEFAULT bBC TO 79
- DEFAULT nDelay TO 0
-
- bBCx := bTCx := ( INT( ( bBC - bTC + 1 ) / 2 ) + bTC )
- bBRx := bTRx := ( INT( ( bBR - bTR + 1 ) / 2 ) + bTR )
- cDefCol := SETCOLOR( cClrs )
- nDelay := IF(valtype(nDelay) = "N",nDelay *=10,0)
- nDelay := IF(nDelay >= 1001,1000,nDelay)
- lShad := IF(empty(lShad), FALSE,lShad)
-
- WHILE TRUE
- FOR xx = 1 TO nDelay
- NEXT
-
- SETCOLOR( 'n+/n' )
- DISPBEGIN()
- SETCOLOR( cClrs )
- @bTRx, bTCx CLEAR TO bBRx, bBCx
- @bTRx, bTCx TO bBRx, bBCx DOUBLE
- if(valtype(lShad) = "L",SHADOW(bTRx,bTCx,bBRx,bBCx,7),NIL)
- DISPEND()
-
- IF bTRx EQ bTR AND bTCx EQ bTC AND bBRx EQ bBR AND bBCx EQ bBC
- EXIT
- ENDIF
-
- bTRx -= IF( bTRx EQ bTR, 0, 1 )
- bTCx -= IF( bTCx EQ bTC, 0, 1 )
- bBRx += IF( bBRx EQ bBR, 0, 1 )
- bBCx += IF( bBCx EQ bBC, 0, 1 )
- ENDDO
- SETCOLOR( cDefCol )
- SETCURSOR( savecur )
- return nil
-
- //ƒƒƒƒƒƒ use List.com to look at the files contents
- FUNCTION ViewIt( cFilename, cWhichFile )
- local SaveFullScreen()
- IF !SWPRUNCMD("PKUNZIP -c "+cWhichFile+" "+cFileName+" | "+"LIST /s",0)
- tone(100,1)
- ENDIF
- RestFullScreen()
- return nil
-
- //ƒƒƒƒƒƒ use Blinker 2.xx and PkUnZip to extract file to disk
- FUNCTION Decomp(cFilename,cWhichFile)
- local nChoice:=0,SaveFullScreen(),oldcolor:= setcolor("w/n")
- local xInfo:={}, cInfo:="", cChkErr:=""
- /*
- * see if file exist and request confirmation to overwrite with the
- * PkZip option "-o" to overwrite and not request confirmation to do so.
- */
- IF FILE(cFilename)
- tone(100,5)
- xInfo:=DIRECTORY(cFileName)
- @ MR,0 say PADC(" FILENAME: "+ cFilename + " " + ;
- "CURRENT DATE: "+ DTOC(xInfo[1,3]) + " " + ;
- "CURRENT TIME: "+ xInfo[1,4] ,80) color "W+/R"
- nChoice:= alert(cFileName+" exist overwrite it?",{" No "," Yes "} )
- IF nChoice EQ 2
- scroll()
- IF !SWPRUNCMD("PKUNZIP -o "+cWhichFile+" "+cFileName,0,"","")
- alert("This is were to handle an error")
- ENDIF
- ELSE
- alert("Aborting decompression")
- ENDIF
- ELSE
- scroll()
- IF !SWPRUNCMD("PKUNZIP "+cWhichFile+" "+cFileName,0,"","")
- alert("This is were to handle an error")
- ENDIF
- ENDIF
- cChkErr:=ZipTest( SWPERRLEV() )
- RestFullScreen()
- setcolor( oldcolor )
- if LEN(cChkErr) <> 0
- alert( cChkErr )
- endif
- return nil
-
- Procedure Shadow( nTr, nTc, nBr, nBc,nColor )
- DEFAULT nColor TO 7
- ShadowStrip( nBr+1, nTc+1, nBr+1, nBc+1,nColor )
- ShadowStrip( nTr+1, nBc+1, nBr+1, nBc+1,nColor )
- Return
- Procedure TMARKER( nTr, nTc, nBr, nBc,nColor )
- ShadowStrip( nBr, nTc, nBr, nBc,nColor )
- ShadowStrip( nTr, nBc, nBr, nBc,nColor )
- Return
- STATIC Procedure ShadowStrip( nTr, nTc, nBr, nBc,nColor )
- local cStrip := SAVESCREEN( nTr, nTc, nBr, nBc )
- local cTemplate := REPLICATE( 'x' +chr(nColor), LEN(cStrip) /2 )
- cStrip := TRANSFORM( cStrip, cTemplate )
- RESTSCREEN( nTr, nTc, nBr, nBc, cStrip )
- Return
-
- function WKEY(nDelay)
- local nKey, cblock
- DO CASE
- CASE pcount() == 0
- nKey := inkey()
- CASE nDelay == NIL .AND. Pcount() == 1
- nKey := inkey(0)
- OTHERWISE
- nKey := inkey(nDelay)
- ENDCASE
-
- cblock := setkey(nKey)
- IF cblock != NIL
- eval(cblock, Procname(1), Procline(1), NIL)
- ENDIF
- RETURN nKey
-
-
-